package interview;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class anhen01 {
    private static int maxDays = Integer.MAX_VALUE;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        in.useDelimiter("\n");
        String s = in.next();
        String[] arr = s.split(" ");
        int[] cost = new int[arr.length - 1];
        for (int i = 0; i < arr.length - 1; i++) {
            cost[i] = Integer.parseInt(arr[i]);
        }
        int has = Integer.parseInt(arr[arr.length - 1]);
        // 贪心算法
        Arrays.sort(cost);


        dfs(cost, 0, has, 0);
        if (maxDays == Integer.MAX_VALUE) {
            System.out.println(-1);
        } else {
            System.out.println(maxDays);
        }
    }

    public static void dfs(int[] cost,int index,int has,int count){
        // 回溯退出条件
        if (index > cost.length - 1){
            return;
        }
        if (has < 0){
            return;
        }
        if (has == 0){
            maxDays = Math.min(maxDays,count);
            return;
        }

        for (int i = index; i < cost.length; i++){
            if (cost[i] > has){
                continue;
            }
            dfs(cost,i,has - cost[i],count + 1);
        }
    }
}
